package com.zxdemo;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSON;
import com.zxdemo.jpa.model.Menu;
import com.zxdemo.service.MenuService;

@Controller
public class Test2Controller {
	@Autowired 
	private MenuService menuService;
	
	@RequestMapping("/index")
	public String index(Model model){
		List<Menu> menuList=menuService.getUserMenuList(1L);
		model.addAttribute("menuList",menuList);
		return "index";
	}

	@RequestMapping("/index1")
	public String index2(Model model){
		List<Menu> menuList=menuService.getUserMenuList(1L);
		model.addAttribute("menuList",menuList);
		return "index1";
	}
	
	@RequestMapping("/index3")
	public String index3(Model model){
		List<Menu> menuList=menuService.getUserMenuList(1L);
		model.addAttribute("menuList",menuList);
		System.out.println(JSON.toJSONString(menuList));
		return "easyui";
	}

}
